org.springframework.http.converter.HttpMessageNotReadableException: | 您所在的位置:网站首页 › invalid json input › org.springframework.http.converter.HttpMessageNotReadableException: |
org.springframework.http.converter.HttpMessageNotReadableException:
木得未来: 可以用的@RequestBody 默认情况下是参数必须必填写。所以才会报这个错误,相关验证源码在adapter中有, 解决这个问题只需要设置@RequestBody中有一个属性:@RequestBody(required = false) 就可以解决了 ,或者说,传递参数的时候传递一个空对象。 顺便提一嘴:@RequestBody 属于json传参数,请求头必须加Content-Type:json/application 的请求头,如果没加,就会发生即便你写着好像是json但是并没有传递过去 。等等的。可以根据上面的去排查问题 。 org.springframework.http.converter.HttpMessageNotReadableException:养-乐多: 遵循HTTP规范为什么不能用?你给个示例出来。 org.springframework.http.converter.HttpMessageNotReadableException:不穿铠甲的穿山甲: postMan发送的请求不要用这个注解,具体为什,可以问postman开发商 org.springframework.http.converter.HttpMessageNotReadableException:苦思冥想行则将至: 很棒 org.springframework.http.converter.HttpMessageNotReadableException:listandlist: 那如果get请求时,怎么接收呢,不用requestbody!! |
CopyRight 2018-2019 实验室设备网 版权所有 |